module AsciidocBib

  # Holds information about a single citation:
  # its reference and any page numbers
  class Citation
    # Reference for a citation
    attr_reader :ref
    # Page numbers
    attr_reader :pages

    # Construct instance of citation, from a reference and definition of page numbers.
    def initialize ref, pages
      @ref = ref
      @pages = pages
      # clean up pages
      @pages = '' unless @pages
      @pages.gsub!("--","-")
    end

    def to_s
      "#{@ref}:#{@pages}"
    end
  end
end

